<!--
 * @页面名称:目录二维码
 * @描述: 
 * @作者: 
 * @Date:
-->
<template>
  <div>
    <el-dialog v-model="dialogVisible" title="目录二维码" width="30%" draggable>
      <!-- <el-space direction="vertical"> -->
      <a-qrcode style="margin: 0 auto" :value="text" />
      <!-- </el-space> -->
      <template #footer>
        <span class="dialog-footer">
          <el-button @click="dialogVisible = false">取消</el-button>
          <el-button type="primary" @click="dialogVisible = false">确认</el-button>
        </span>
      </template>
    </el-dialog>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";
import { useDynamicStore } from "@/stores/modules/dynamic";
import { useDictionryStore } from "@/stores/modules/dictionary";
import { useCatalogStore } from "@/stores/modules/catalog";
import { useRoute } from "vue-router";

const route = useRoute();
// 获取路由参数
const routeData = route.query; // 路由携带的参数
const childrenFmtId: any = routeData.childrenFmtId ? routeData.childrenFmtId : undefined;

const dynamicStore = useDynamicStore();
const catalogStore = useCatalogStore();
// 弹出框显示和隐藏
const dialogVisible = ref(false);
// 二维码信息
const text = ref("");

const open = () => {
  text.value = `${window.location.origin}${import.meta.env.VITE_PUBLIC_PATH}#skip?M=1&fmid=${routeData.fmid}&fmtid=${
    routeData.fmtid
  }&catalogid=${catalogStore.treeNode.Catalog_ID}&searchType=${"1"}&status=${routeData.status}&pageIndex=${1}&pageSize=${
    dynamicStore.pageSize
  }&childrenFmtId=${childrenFmtId}&fondsId=${routeData.fondsId}`;
  dialogVisible.value = true;
  console.log(text.value);
};

defineExpose({ open });
</script>

<style scoped></style>
